<?php
/**
 * Debug Function
 * @version $Id: Debug.php 2371 2012-08-20 09:13:15Z tamlt2 $
 */

function printr($data, $die = true)
{
	if (SGN_Application::isInternalUser() || SGN_Application::isAdminSite()) {
		$trace = debug_backtrace();
		$caller = array_shift($trace);
		echo '<pre>';
		echo "called by [" . $caller['file'] . "] line: " . $caller['line'];
		var_dump($data);
		if ($die) {
			exit();
		}
	}
}
/*
function pr($data, $die = true)
{
	if (SGN_Application::isInternalUser() || SGN_Application::isAdminSite()) {
		$trace = debug_backtrace();
		$caller = array_shift($trace);
		echo '<pre>';
		echo "called by [" . $caller['file'] . "] line: " . $caller['line'] . "\n";
		print_r($data);
		if ($die) {
			exit();
		} else {
			echo "\n";
		}
	}
}
*/
function pr($data, $die = true)
{
	if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
		$trace = debug_backtrace();
		$caller = array_shift($trace);
		echo '<pre>';
		echo "called by [" . $caller['file'] . "] line: " . $caller['line'] . "\n";
		print_r($data);
		if ($die) {
			exit();
		} else {
			echo "\n";
		}
	}
}